#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e3+10;
int n,m,head[MAXN],cnt,ans,root[MAXN],belong[MAXN],stac[MAXN],top;
struct edge
{
	int v,next;
}e[MAXN*2];
void addedge(int x,int y)
{
	e[++cnt]=(edge){y,head[x]};
	head[x]=cnt;
	return;
}
void dfs(int u,int fa)
{
	int now=top;
	for(int i=head[u];i;i=e[i].next)
	{
		int v=e[i].v;
		if(v==fa)continue;
		dfs(v,u);
		if(top-now>=m)
		{
			root[++ans]=u;
			while(top!=now)belong[stac[top--]]=ans;
		}
	}
	stac[++top]=u;
	return;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<n;++i)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		addedge(x,y);
		addedge(y,x);
	}
	dfs(1,0);
	while(top)belong[stac[top--]]=ans;
	printf("%d\n",ans);
	for(int i=1;i<=n;++i)printf("%d ",belong[i]);
	puts("");
	for(int i=1;i<=ans;++i)printf("%d ",root[i]);
	puts("");
	return 0;
}
